#ifndef SOUNDPLAYER_H
#define SOUNDPLAYER_H

#include <phonon/MediaObject>
#include <phonon/MediaSource>
#include <phonon/AudioOutput>
#include <phonon/Path>
#include <phonon/ObjectDescription>
#include <iostream>

// class implementing a Phonon sound player 
// using the Singleton pattern
class SoundPlayer : public QObject{

	Q_OBJECT
	
public:
	static SoundPlayer* getInstance();
	static void destroyInstance();
	
	void setPosition(qint64 position);
	void setAudiofile(QString string);
	Phonon::MediaObject* getPlayerObject(){ return mMediaObject; };

public slots:
	void play();
	void stop();
	void playStopKey();

private:
	// private constructor
	SoundPlayer();	
	~SoundPlayer();
	
	// Singleton
	static SoundPlayer* instance;
	
	// Private Members
	qint64 mPosition;
	Phonon::AudioOutput *mAudioOutput;
	Phonon::MediaObject *mMediaObject;
	
};

/*
class SoundPlayer : public QObject{
	
	Q_OBJECT
	
public:
	// Public Functions
	SoundPlayer(const char* filename); // Constructor
	~SoundPlayer();
	
	void setPosition(qint64 position);
	void setAudiofile(QString string);
	
	Phonon::MediaObject* getPlayerObject(){ return mMediaObject; }
	
	public slots:
	void play();
	void stop();
	void playStopKey();
	
private:
	// Private Members
	qint64 mPosition;
	Phonon::AudioOutput *mAudioOutput;
	Phonon::MediaObject *mMediaObject;
	
};
*/

#endif // SOUNDPLAYER_H
